//列表页中，初始化数据用
$(function () {
    console.log('页面初始化以后');
    axios.get(`http://localhost:5000/teacher`).then((res => {
        let data = res.data;
        let blogs = data.data;
        blogs.forEach(item => {
            let html = `
            <tr class="blog${item.id}">
                <td>${item.id}</td>
                <td>${item.teacherName}</td>
             <td>${item.teacherSex}</td>

                <td>${item.teacherAge}</td>
                <td>
                    <input type="button" value="编辑" onclick="btnEdit(${item.id})">
                    <input type="button" value="删除" onclick="btnDel(${item.id})">
                </td>
            </tr>`

            $('tbody').append(html)
        })
    }))

})

function btnEdit(id) {
    console.log(
        "111"
    );
  location.href=`./addOrUpd.html?id=${id}`  
}